import { getMenusOrderNo } from "@/router/menus/index";

const modules = import.meta.globEager("./modules/**/*.js");

let routeModuleList = [];

Object.keys(modules).forEach((key) => {
  const mod = modules[key].default || {};
  mod.meta.orderNo = getMenusOrderNo(mod.path);
  const modList = Array.isArray(mod) ? [...mod] : [mod];
  routeModuleList.push(...modList);
});
routeModuleList = routeModuleList.sort(
  (a, b) => a.meta.orderNo - b.meta.orderNo
);

export default routeModuleList;
